const BASE_URL = `https://picsum.photos/v2`

export async function getList(page = 1) {
  const response = await fetch(`${BASE_URL}/list?page=${page}`)
  const photos = await response.json()
  return photos
}

export function formatPhotoUri(id, width, height) {
  return `https://picsum.photos/id/${id}/${Math.floor(width)}/${Math.floor(
    height
  )}`
}


// import axios from "axios";

// const instance = axios.create({
//   baseURL: 'http://localhost:9000/api/',
//   timeout: 1000,
//   headers: { 'X-Custom-Header': 'foobar' }
// });

// Override timeout default for the library
// Now all requests using this instance will wait 2.5 seconds before timing out
instance.defaults.timeout = 2500;

    // onPress: async () => {
    //   try {
    //     // axios.post("https://api.abc.com" +'/send');

    //     // Override timeout for this request as it's known to take a long time
    //     let result = await instance.get('/longRequest', {
    //       timeout: 5000
    //     });
    //     console.log({tag:'ana',result});

    //     // // GET request for remote image in node.js
    //     // axios({
    //     //   method: 'get',
    //     //   url: 'https://bit.ly/2mTM3nY',
    //     //   responseType: 'stream'
    //     // })
    //     //   .then(function (response) {
    //     //     // response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
    //     //   });

    //   } catch (error) {
    //     console.log("error is-->", error);
    //   }
    // },